package com.ekuaitu.kuaitu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by Michael Pi on 2016/9/21.
 */
public class CouponPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> list = null;
    private String[] arrTabTitles = null;

    public CouponPagerAdapter(FragmentManager fm, List<Fragment> list, String[] arrTabTitles) {
        super(fm);
        this.list = list;
        this.arrTabTitles = arrTabTitles;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    /**
     * tablayout显示导航标题
     *
     * @param position
     * @return
     */
    @Override
    public CharSequence getPageTitle(int position) {

        return arrTabTitles[position];
    }
}